<template>
  <div class="lineChart" ref="lineChart"></div>
</template>

<script>
import echarts from "echarts";
export default {
  name: "lineChart",
  mounted() {
    let myCharts = echarts.init(this.$refs.lineChart);
    myCharts.setOption({
      xAxis: {
        type: "category",
        show: false,
      },
      yAxis: {
        show: false,
      },
      series: [
        {
          type: "line",
          data: [10, 20, 30, 50, 30],
          //拐点的样式的设置
          itemStyle: {
            opacity: 0,
          },
          //线条的样式
          lineStyle: {
            color: "purple",
          },
          //填充颜色的设置
          areaStyle: {
            color: {
              type: "linear",
              x: 0,
              y: 0,
              x2: 0,
              y2: 1,
              colorStops: [
                {
                  offset: 0,
                  color: "purple", //0%处的颜色
                },
                {
                  offset: 1,
                  color: "#fff", //100%处的颜色
                },
              ],
              global: false,
            },
          },
        },
      ],
      grid: {
        left: 0,
        top: 0,
        right: 0,
        bottom: 0,
      },
    });
  },
};
</script>

<style lang="scss" scoped>
.lineChart {
  width: 100%;
  height: 100%;
}
</style>